package cn.have.controller;

import cn.have.domain.CommonResult;
import cn.have.domain.Order;
import cn.have.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName OrderController
 * @Author 王新
 * @Date: 2022/2/3 8:36 星期四
 * @Version 1.0
 * @Description
 */
@RestController
public class OrderController {

    @Resource
    private OrderService orderService;

    @GetMapping("/order/create")
    @GlobalTransactional(name = "fsp-create-order",rollbackFor = Exception.class)
    public CommonResult create(Order order) {
        orderService.create(order);
        return new  CommonResult(200, "订单创建成功");
    }
}
